@echo off

cd %~dp0

echo clean previous patch files...
del /Q *.patch

call groovy applypatch.groovy %~dp0

for /f %%i in ('dir /b *.patch') do (echo apply patch %%i ... && git am < %%i && echo apply patch success! || goto end)	

echo clean patch file?[n]
set /p YN=
if "%YN%" == "" goto exit

del /Q *.patch
del /Q *.patch.cp

echo clean patch done!

:end
pause

:exit